package view.clock_panel;

import java.awt.event.ActionEvent;

import listener.ParticipantChangeEvent;

import clock.Clock;
import clock.TimeCounter;

public abstract class ClockChangeButton extends BasicButton {
	private static final long serialVersionUID = 7223140360831495052L;
	
	public final static int MINUTE = 0;
	public final static int SECOND = 1;
	
	protected Clock clock;
	protected TimeCounter currentHand;
	
	public ClockChangeButton() {
		super();
	}
	
	public void actionPerformed(ActionEvent e) {
		onClick();
	}
	
	public void participantChange(ParticipantChangeEvent e) {
		clock = e.getSource().getClock();
		currentHand = clock.getSecond();
	}
	
	public void countOn(int clock){
		switch(clock){
			case MINUTE: 
				currentHand = this.clock.getMinute();
				break;
			case SECOND: 
				currentHand = this.clock.getSecond();
				break;
			default:
				break;
		}
	}
	
	public abstract void onClick();
}
